<template>
  <div class="innerupload-dialog">
    <el-dialog
      :visible.sync="dialog"
      :before-close="handleClose"
      width="700px"
      title="本地上传"
      append-to-body
    >
      <img v-if="show" src="/src/icons/noimg@2x.png" alt>
      <el-upload
        ref="innerupload"
        :file-list="fileList"
        :auto-upload="false"
        :limit="1"
        class="upload-demo"
        action="https://jsonplaceholder.typicode.com/posts/"
      >
        <el-button slot="trigger" size="small" type="primary" style="margin-top:10px;">选取文件</el-button>
        <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，建议图片尺寸为170*95，且不超过500kb</div>
      </el-upload>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="handleSubmit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    innerVisible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      show: true,
      fileList: []
    }
  },
  computed: {
    dialog() {
      return this.innerVisible
    }
  },
  methods: {
    handleClose() {
      this.$emit('closeInner')
    },
    handleSubmit() {
      this.$emit('closeInner')
    }
  }
}
</script>

<style lang="scss">
</style>
